package com.sun.interceptor;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: glorysun
 * @date: 2020/7/16
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    /*
     * @ Description :拦截无权限请求
     * @ author : glorysun
     * @ param : [registry]
     * @ return : void
     * @ exception :
     * @ date : 2020/7/16 15:12
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/admin/**")
                .excludePathPatterns("/admin")
                .excludePathPatterns("/admin/login");
    }
}
